package com.yl.utils;

import java.util.Base64;

public class ShengWangUtils {
    //
    // // 客户 ID
    // // 需要设置环境变量 AGORA_CUSTOMER_KEY
    // final String customerKey = System.getenv("AGORA_CUSTOMER_KEY");
    // // 客户密钥
    // // 需要设置环境变量 AGORA_CUSTOMER_SECRET
    // final String customerSecret = System.getenv("AGORA_CUSTOMER_SECRET");

    public static String getToken(String customerKey, String customerSecret) {

        // 拼接客户 ID 和客户密钥并使用 base64 编码
        String plainCredentials = customerKey + ":" + customerSecret;
        String base64Credentials = new String(Base64.getEncoder().encode(plainCredentials.getBytes()));
        // 创建 authorization header
        String authorizationHeader = "Basic " + base64Credentials;
        return authorizationHeader;
    }
}
